package com.kingmed.kmss.admin.modules.ums.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kingmed.kmss.admin.modules.ums.model.UmsAdminLoginLog;
import com.kingmed.kmss.admin.modules.ums.service.UmsAdminLoginLogService;
import com.kingmed.kmss.common.vo.CommonPage;
import com.kingmed.kmss.common.vo.CommonResponse;
import com.kingmed.kmss.common.vo.CommonResponseHelper;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 后台用户登录日志表 前端控制器
 * </p>
 */
@RestController
@RequestMapping("/ums/log")
@Api(tags = "ums用户登录日志")
public class UmsAdminLoginLogController {

    @Autowired
    private UmsAdminLoginLogService umsAdminLoginLogService;

    @ApiOperation("分页模糊查询用户登录日志")
    @GetMapping(value = "/list")
    @ResponseBody
    public CommonResponse<CommonPage<UmsAdminLoginLog>> list(@RequestParam(required = false) String keyword,
                                                             @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        Page<UmsAdminLoginLog> resourceList = umsAdminLoginLogService.list(keyword, pageSize, pageNum);
        return CommonResponseHelper.success(CommonPage.restPage(resourceList));
    }
}
